console.log('vip视频解析插件已经加载。');
chrome.runtime.onInstalled.addListener(function() {
  chrome.contextMenus.create({
    id: 'vip-search',
    title: 'vip视频解析'
  });
  chrome.contextMenus.onClicked.addListener(function(info, tab) {

    console.log('to_vip。');
    console.log(info);
    console.log(tab);
    var currentUrl = tab.url;
    console.log(currentUrl);
    var vipArr = new Array();
    vipArr.push('http://api.apii.top/?v=');
    vipArr.push('https://jx.xmflv.cc/?url=');
    vipArr.push('https://www.8090g.cn/?url=');
    vipArr.push('https://www.8090.la/8090/?url=');
    vipArr.push('https://jx.m3u8.tv/jiexi/?url=');
    vipArr.push('https://jx.playerjy.com/?url=');
    vipArr.push('https://www.playm3u8.cn/jiexi.php?url=');
    vipArr.push('https://svip.bljiex.cc/?v=');
    vipArr.push('https://www.ckplayer.vip/jiexi/?url=');
    vipArr.push('https://yparse.ik9.cc/index.php?url=');
    vipArr.push('https://www.pangujiexi.com/jiexi/?url=');

    var randomVipIndex = Math.floor(Math.random() * vipArr.length);
    var newUrl = vipArr[randomVipIndex] + currentUrl;
    console.log(newUrl);
    chrome.tabs.create({
      url: newUrl
    });
  });
});


